package com.sj.boot.modules.sys.service;

import com.sj.boot.common.Result;
import com.sj.boot.modules.sys.model.Activity;
import com.sj.boot.modules.sys.repository.ActivityRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActivityService {

    private ActivityRepository activityRepository;

    public ActivityService(ActivityRepository activityRepository){
        this.activityRepository= activityRepository;
    }


    public Activity SaveOrUpdateActivity(Activity activity){
        return activityRepository.save(activity);
    }


    public Activity getActivityById(Long id) {
        return activityRepository.getOne(id);
    }

    public List<Activity> getAll(){
        return activityRepository.findAll();
    }
}
